package org.springcloud.plugin.stragegy.sentinel.parser;

import com.alibaba.csp.sentinel.datasource.Converter;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

import java.util.List;

/**
 * @Author yanggld
 * @Date 2020/1/10-15:29
 * @Description
 * 降级规则
 */
public class SentinelDegradeRuleParser implements Converter<String, List<DegradeRule>> {
	@Override
	public List<DegradeRule> convert(String source) {
		return JSON.parseObject(source, new TypeReference<List<DegradeRule>>() {});
	}
}